package homework.demo;

public class User {
    private String userName;
    private int password;

    public User(String name, int password){
        this.initMesg(name,password);
    }
    public Boolean verfiyFun(String name,int password){
        UserManger manger =new UserManger(this);
        Boolean label=manger.verify(name,password);
        return label;
    }
    public void initMesg(String userName,int password){
        this.setUserName(userName);
        this.setPassword(password);
        System.out.println("设置成功");

    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public int getPassword() {
        return password;
    }

    public void setPassword(int password) {
        this.password = password;
    }
}
class UserManger{
    private final User user;
    public UserManger(User user){
        this.user=user;
    }
    public boolean verify(String name,int password){
        if (name.equals(user.getUserName()) && password == user.getPassword()) {
            return true;
        }
        return false;
    }



}
